<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                template="/template/StakeholderTTATemplate.xhtml">

    <ui:define name="contentInsert">
        <c:if test="#{checkBIPaymentMB.checkIsPaid()}">
            <h:outputText style="color: #D20005; font-family: verdana; font-weight: bold;
                          font-size: larger;"
                          value="Here CLV is calculated using this function: "/> 
            <br/>
            <p:graphicImage value="/ttaImage/clv.PNG"/><br/>
            <h:outputText value="GC: Gross Contribution Per Customer" style="font-family: sant-serif; font-size: small"/> <br/>
            <h:outputText value="r: Retension Rate (how many percentage of customers stay)" style="font-family: sant-serif; font-size: small"/><br/>
            <h:outputText value="d: Discount Rate (inflation rate)" style="font-family: sant-serif; font-size: small"/><br/>
            <h:outputText style="color: #D20005; font-family: sant-serif; 
                          font-size: small"
                          value="Note: CLV is done on a yearly basis."/>
            <h:outputText style="color: #D20005; font-family: sant-serif; font-size:small"
                          value="(if a stakeholder is created less than a year, clv is 99999)."/>
            <br/>
            <br/>
            <h:form>
                <hr/>
                <h4> Parameters </h4> 
                <h:panelGrid columns="2" style="border-bottom-style: groove; border-top-style: groove;
                             width: 100%; margin-top: 10px; margin-bottom: 10px; background: #fbf8ee" >
                    <h:outputText value="Discount Rate:" />
                    <p:inputText value="#{custAnalysisMB.discountRate}" />
                    <h:outputText value="ACSR(Average customer spending per reservation):"/>
                    <p:inputText value="#{custAnalysisMB.expPerRes}" />
                    <p:commandButton value="Enter" update="clv" actionListener="#{custAnalysisMB.updateCLVParameter}"/>
                    <h:outputText/>
                </h:panelGrid>

                <hr/>

                <h4> Result </h4>
                <h:panelGrid columns="2" style="border-bottom-style: groove;
                             width: 50%; margin-top: 10px; margin-bottom: 20px;">

                    <h:outputText value="CLV:"/>
                    <h:outputText id="clv" value="#{custAnalysisMB.CLVStr}" style="font-weight: bold"/>
                </h:panelGrid>
                <hr/>
            </h:form>
        </c:if>
    </ui:define>
</ui:composition>
